]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
st: Make StScrollables' paint volume reflect the unconstrained view
authorCarlos Garnacho <carlosg@gnome.org>
Wed, 16 May 2018 21:57:38 +0000 (23:57 +0200)
committerGeorges Basile Stavracas Neto <georges.stavracas@gmail.com>
Fri, 13 Jul 2018 11:53:45 +0000 (11:53 +0000)
And constrain it in StScrollView instead (instead of falling back to an
infinite paint volume, as the actor as paint/pick impls, but no
corresponding get_paint_volume one).

Fixes artifacts with the AppView (and possibly other places) when paint
volumes are aggressively cached.

src/st/st-box-layout.c
src/st/st-scroll-view.c

index ffb74770ca2e78cc6c0fead863baded9e3fd6415..12fe86910491ece21f539acfbb00b105539e040e 100644 (file)
@@ -490,7 +490,7 @@ st_box_layout_get_paint_volume (ClutterActor       *actor,
                                 ClutterPaintVolume *volume)
 {
   StBoxLayout *self = ST_BOX_LAYOUT (actor);
-  gdouble x, y;
+  gdouble x, y, lower, upper;
   StBoxLayoutPrivate *priv = self->priv;
   StThemeNode *theme_node = st_widget_get_theme_node (ST_WIDGET (actor));
   ClutterActorBox allocation_box;
@@ -505,13 +505,42 @@ st_box_layout_get_paint_volume (ClutterActor       *actor,
    * our paint volume on that. */
   if (priv->hadjustment || priv->vadjustment)
     {
+      gdouble width, height;
+
       clutter_actor_get_allocation_box (actor, &allocation_box);
       st_theme_node_get_content_box (theme_node, &allocation_box, &content_box);
       origin.x = content_box.x1 - allocation_box.x1;
       origin.y = content_box.y1 - allocation_box.y2;
       origin.z = 0.f;
-      clutter_paint_volume_set_width (volume, content_box.x2 - content_box.x1);
-      clutter_paint_volume_set_height (volume, content_box.y2 - content_box.y1);
+
+      if (priv->hadjustment)
+        {
+          g_object_get (priv->hadjustment,
+                        "lower", &lower,
+                        "upper", &upper,
+                        NULL);
+          width = upper - lower;
+        }
+      else
+        {
+          width = content_box.x2 - content_box.x1;
+        }
+
+      if (priv->vadjustment)
+        {
+          g_object_get (priv->vadjustment,
+                        "lower", &lower,
+                        "upper", &upper,
+                        NULL);
+          height = upper - lower;
+        }
+      else
+        {
+          height = content_box.y2 - content_box.y1;
+        }
+
+      clutter_paint_volume_set_width (volume, width);
+      clutter_paint_volume_set_height (volume, height);
     }
   else if (!CLUTTER_ACTOR_CLASS (st_box_layout_parent_class)->get_paint_volume (actor, volume))
     return FALSE;
index bb26f540b5bb7fec900055e8707c27a7b2aab9d5..fc0db1c998e01678fe4e9de9c4d055667ece402f 100644 (file)
@@ -304,6 +304,13 @@ st_scroll_view_pick (ClutterActor       *actor,
     clutter_actor_paint (priv->vscroll);
 }
 
+static gboolean
+st_scroll_view_get_paint_volume (ClutterActor       *actor,
+                                 ClutterPaintVolume *volume)
+{
+  return clutter_paint_volume_set_from_allocation (volume, actor);
+}
+
 static double
 get_scrollbar_width (StScrollView *scroll,
                      gfloat        for_height)
@@ -793,6 +800,7 @@ st_scroll_view_class_init (StScrollViewClass *klass)
 
   actor_class->paint = st_scroll_view_paint;
   actor_class->pick = st_scroll_view_pick;
+  actor_class->get_paint_volume = st_scroll_view_get_paint_volume;
   actor_class->get_preferred_width = st_scroll_view_get_preferred_width;
   actor_class->get_preferred_height = st_scroll_view_get_preferred_height;
   actor_class->allocate = st_scroll_view_allocate;